import { post } from './request.js'

// 用户登录
export function login(data) {
  return post('/user/login', {
    username: data.username,
    password: data.password
  })
}

// 用户注册
export function register(data) {
  return post('/user/regin', {
    username: data.username,
    password: data.password
  })
}

// 获取用户信息
export function getUserInfo(username) {
  return post('/user/getUser', {}, {
    username: username
  })
}

// 更新用户信息
export function updateUserInfo(data) {
  return post('/user/updUser', data)
}

// 修改密码
export function changePassword(data) {
  return post('/user/updPassword', {
    oldPassword: data.oldPassword,
    newPassword: data.newPassword
  })
}
